package com.wengluobiancheng.demo06;

import java.io.*;
import java.net.Socket;

public class ClientDemo01 {
    public static void main(String[] args) throws IOException {
        Socket sk = new Socket("192.168.29.222", 20001);

        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\itheima\\qs.jfif"));

        OutputStream os = sk.getOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(os);

        int c;
        while ((c = bis.read()) != -1) {
            bos.write(c);
        }
        bos.flush();
        sk.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(sk.getInputStream()));
        String q;
        while ((q = br.readLine()) != null) {
            System.out.println(q);
        }

        bis.close();
        sk.close();
    }
}
